using System;
using System.ComponentModel;
using System.Windows.Forms;
using App.Modelo.Interfaces;

namespace App.Git.Vista.Widget
{
    public partial class IdentificacionCliente : UserControl
    {
        public event PropertyChangedEventHandler ValorChanged;

        [Bindable(true)]
        public IDocumento Valor
        {
            get
            {
                return documentoBindingSource.DataSource is IDocumento
                           ? (IDocumento) documentoBindingSource.DataSource
                           : null;
            }
            set { documentoBindingSource.DataSource = value; }
        }

        public IdentificacionCliente()
        {
            InitializeComponent();
            documentoBindingSource.DataSource = new Documento();
        }

        private void documentoBindingSource_CurrentItemChanged(object sender, EventArgs e)
        {
            if (ValorChanged != null)
                ValorChanged(this, new PropertyChangedEventArgs("Valor"));
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
